home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness: Critical Thinking Skills / Workplace Effectiveness: Critical Thinking Skills.iso / pc / Files / Whyfiles.dxr / 00018_Pushbutton that changes a different cast member w-handler attached.ls < prev    next >
Encoding:
Text File  |  1998-09-14  |  2.0 KB  |  57 lines

  1. property UpCM, DownCM, UpNum, DownNum, changeSprite, button_active, theHandler
  2.  
  3. on mouseDown me
  4.   set the member of sprite the changeSprite of me to member the DownCM of me
  5.   set the loc of sprite the changeSprite of me to point(320, 240)
  6.   set the button_active of me to 1
  7. end
  8.  
  9. on mouseUp me
  10.   set the button_active of me to 0
  11.   do(theHandler)
  12. end
  13.  
  14. on mouseEnter me
  15.   if the button_active of me then
  16.     set the loc of sprite the changeSprite of me to point(320, 240)
  17.   end if
  18. end
  19.  
  20. on mouseLeave me
  21.   if the button_active of me then
  22.     set the loc of sprite the changeSprite of me to point(-4444, -4444)
  23.   end if
  24. end
  25.  
  26. on mouseUpOutSide me
  27.   set the button_active of me to 0
  28. end
  29.  
  30. on beginSprite me
  31.   set the UpCM of me to the member of sprite the spriteNum of me
  32.   set the UpNum of me to the number of member UpCM
  33.   set the DownNum of me to the number of member DownCM
  34.   set the button_active of me to 0
  35. end
  36.  
  37. on endSprite me
  38. end
  39.  
  40. on getPropertyDescriptionList
  41.   if the currentSpriteNum = 0 then
  42.     set memdefault to 0
  43.   else
  44.     set memref to the member of sprite the currentSpriteNum
  45.     set memName to the name of member memref
  46.     set downName to memName && "dn"
  47.     set castLibNum to the castLibNum of memref
  48.     set memdefault to member downName of castLib castLibNum
  49.   end if
  50.   set p_list to [#DownCM: [#comment: "Hilite Image:", #format: #graphic, #default: memdefault], #changeSprite: [#comment: "The other sprite to change:", #format: #integer, #default: 120], #theHandler: [#comment: "Handler to activate:", #format: #string, #default: EMPTY]]
  51.   return p_list
  52. end
  53.  
  54. on getBehaviorDescription
  55.   return "Makes a sprite work as a pushbutton with automatic highlighting and mouse tracking. The sprite's initial castmember represents the button's normal state." & RETURN & "PARAMETERS:" & RETURN & "‚Ä¢ Hilite Image - Member to display when the button is pressed. The default is the same name followed by a SPACE and dn" & RETURN & "Activates a different sprite to change for the down state, sending it to the center of the stage, and calls the script chosen in the parameter dialog."
  56. end
  57.